package ressource;

import java.sql.Date;
import java.sql.Timestamp;

public class CadreAnnonce {
	
	private String etat;
	private float prix;
	private int stock;
	private Timestamp dateCreation;
	private Date dateExpiration;
	private String commentaire;
	private Integer idAnnonce;
	
	public Integer getIdAnnonce() {
		return idAnnonce;
	}
	public void setIdAnnonce(Integer id) {
		this.idAnnonce = id;
	}
	public String getEtat() {
		return etat;
	}
	public void setEtat(String etat) {
		this.etat = etat;
	}
	public float getPrix() {
		return prix;
	}
	public void setPrix(float prix) {
		this.prix = prix;
	}
	public int getStock() {
		return stock;
	}
	public void setStock(int stock) {
		this.stock = stock;
	}
	public String getDateCreation() {
		if(dateCreation == null) return null;
		else{
			String[] buffer = dateCreation.toString().split("[- :]");
			return buffer[2] + "/" + buffer[1] + "/" + buffer[0] + " " + buffer[3] + "h" + buffer[4];
		}
	}
	public void setDateCreation(Timestamp dateCreation) {
		this.dateCreation = dateCreation;
	}
	public String getDateExpiration() {
		if(dateExpiration == null) return null;
		else{
			String[] buffer = dateExpiration.toString().split("[- :]");
			return buffer[2] + "/" + buffer[1] + "/" + buffer[0];
		}
	}
	public void setDateExpiration(Date dateExpiration) {
		this.dateExpiration = dateExpiration;
	}
	public String getCommentaire() {
		return commentaire;
	}
	public void setCommentaire(String commentaire) {
		this.commentaire = commentaire;
	}
}
